package com.shanzmoo.platform.tomerchant.api.util;

import com.shanzmoo.base.bean.BaseRedisKeyUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * redis key 操作工具类
 *
 * @author： Gzhao 2021/4/3
 */
public class RedisKeyUtils extends BaseRedisKeyUtils {

    private final static String SECOND_LEVEL = "api:mma:";

    private RedisKeyUtils(){}

    public static String installKey(String... strList) {
        List<String> list = new ArrayList<>();
        list.add(SECOND_LEVEL);
        list.addAll(Arrays.asList(strList));
        return installBaseKey(list);
    }
    /**
     * 组装入驻商户验证 key
     * @param subject
     * @return
     */
    public static String installMerchantCheckKey(String subject) {
        return installKey(KeyPrefix.MERCHANT_MOBILE, subject);
    }

    private static class KeyPrefix{
        /**
         * 验证商户信息时 在 Redis 中保存的key前缀
         */
        private static String MERCHANT_MOBILE = "auth_mobile:";
    }

}
